package com.yadong.demo01;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Component
public class Bean2 {
	private String name = "bean2";

	@Autowired
	Bean1 bean1;

	public Bean2() {

	}

	public Bean2(String name) {
		this.name = name;
	}

	public Bean1 getBean1() {
		return bean1;
	}

	public void setBean1(Bean1 bean1) {
		this.bean1 = bean1;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return "Bean2{" +
				"name='" + name + '\'' +
				", bean1.name=" + bean1.getName() +
				'}';
	}
}
